﻿using System;
using System.Collections.Generic;
using System.Text;

namespace daSyntaxAnalyser.SyntaxTree
{
    using daBase.Objects;

    public class ExportsElement : SyntaxTreeElement
    {
        private List<ExportsElementElement> elements;

        public List<ExportsElementElement> Elements { get { return elements; } set { elements = value; } }

        public ExportsElement(TokenInfo StartInfo, List<ExportsElementElement> Elements, List<TokenInfo> Comments)
            : base(StartInfo, Comments)
        {
            elements = Elements;
        }

        public override string ToString()
        {
            return string.Format("exports{0};", ((elements != null) && (elements.Count > 0)) ? string.Format("\r\n{0}", Tabulate(elements.Join(",\r\n"))) : string.Empty);
        }

        protected override IEnumerator<ISyntaxTreeElement> CreateEnumerator()
        {
            foreach (ExportsElementElement element in elements)
                yield return element;
        }
    }
}
